home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / util / time / restoretime.lha / restoretime.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-21  |  681 b   |  29 lines

  1. /*
  2.     Restore CIA Timer
  3.     Thomas Radtke 20.03.95
  4.     Report bugs/other types of E-Clocks for implementing to
  5.     thradtke@nereid.rz.uni-osnabrueck.de
  6.     E-Mail Address valid at least until Oct, 95
  7. */
  8.  
  9. #include <intuition/intuitionbase.h>
  10. #include <resources/battclock.h>
  11.  
  12. struct timerequest tr;
  13. struct Library *BattClockBase;
  14.  
  15. main()
  16. {
  17.     ULONG secs;
  18.  
  19.     if (!(BattClockBase=(struct Library *)OpenResource(BATTCLOCKNAME))) exit(1);
  20.     OpenDevice(TIMERNAME,UNIT_MICROHZ,(struct IORequest *)&tr,0);
  21.     secs=(ULONG)ReadBattClock();
  22.     tr.tr_node.io_Command=TR_SETSYSTIME;
  23.     tr.tr_time.tv_secs=secs;
  24.     tr.tr_time.tv_micro=0;
  25.     DoIO((struct IORequest *)&tr);
  26.     CloseDevice((struct IORequest *)&tr);
  27.     exit(0);
  28. }
  29.